import request from '@/utils/request.js';

// 参数列表
export const getParamsList = (id, params) => {
  return request({
    method: 'GET',
    url: `categories/${id}/attributes`,
    params
  });
};

// 添加动态或静态属性
export const addAttributes = (id, data) => {
  return request({
    method: 'POST',
    url: `categories/${id}/attributes`,
    data
  });
};

// 编辑提交参数
export const commitParams = (id, arrtrid, data) => {
  return request({
    method: 'PUT',
    url: `categories/${id}/attributes/${arrtrid}`,
    data
  });
};

// 根据id查询参数
export const getParams = (id, arrtrid, params) => {
  return request({
    method: 'GET',
    url: `categories/${id}/attributes/${arrtrid}`,
    params
  });
};

// 删除参数
export const deletParams = (id, arrtrid) => {
  return request({
    method: 'DELETE',
    url: `categories/${id}/attributes/${arrtrid}`
  });
};

// 编辑并提交参数
export const editParams = (id, arrtrid, data) => {
  return request({
    method: 'PUT',
    url: `categories/${id}/attributes/${arrtrid}`,
    data
  });
};

